package dao;

import pojo.Note;
import util.JDBC;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

public class Imp_Sysmanage implements SystemManager{
    /**
     * 判断系统管理员登录
     * @param name
     * @param password
     * @return
     */
    public boolean sysmanagerlogin(String name,String password){
        boolean flag=false;
        try {
            JDBC jdbc=new JDBC();
            jdbc.dbconn();
            ResultSet rs= JDBC.selectsql("select * from systemmanger");
            while(rs.next()) {
                if (name.equals(rs.getString("name"))) {
                    if (password.equals(rs.getString("password"))) {
                        flag = true;
                        break;
                    }
                }
            }
            jdbc.closeconn();

        } catch (SQLException e) {
            e.printStackTrace();
        }
        return flag;
    }
    /**
     * 查看所有用户的所有笔记，调用Note类的showAllNotes方法
     * @return
     */
    public ArrayList<Note> allnotes(){
        ImplementNote implementNote=new ImplementNote();
        ArrayList<Note> allnotes=implementNote.showAllNotes();
        return allnotes;
    }
}
